<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
    <input >
</body>
<script>
    
    function handleClick(){
        console.log("这是测试！")
    };

    /**
     * 思路是点击之后n秒内执行，如果重复点击则以最后一次的点击开始计算时间
     * */
    function debounce(fn,wait){
    var timer = null;
    return function(){
        if(timer !== null){
            clearTimeout(timer);
        }
        timer = setTimeout(fn,wait);
    }
}

    
window.addEventListener("click",debounce(handleClick,1000));
</script>
</html> 
